#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021, Thomas Sommer
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------

def init(module):
    module.name = ":driver:encoder_input.bitbang"
    module.description = """
# Quadrature Encoder Input

This driver decodes an AB (incremental) encoder signal.
Ported from code created by Peter Dannegger:
https://www.mikrocontroller.net/articles/Drehgeber.
"""


def prepare(module, options):
    module.depends(":architecture:atomic")
    return True


def build(env):
    env.outbasepath = "modm/src/modm/driver/encoder"
    env.copy("bitbang_encoder_input.hpp")
    env.copy("bitbang_encoder_input_impl.hpp")
